package com.cxria.script

def cmdUtils = new CmdUtils()
String.metaClass.exec = {
    cmdUtils.execute(delegate)
}

def rootPath = '/usr/local/qshell'
def qshellListFile = new File("${rootPath}/qshell-result.txt")
def bigLines = qshellListFile.readLines()
def videoInfos = [:]
bigLines.each { line ->
    def lineInfo = line.split('\t')
    def videoNameInfo = lineInfo[0]
    def videoSize = lineInfo[1] as BigInteger
    videoInfos.put(videoNameInfo, videoSize)
}

def sizes = videoInfos.values().sort(true) { o1, o2 ->
    o2.compareTo(o1)
}

def maxSize = sizes[0]

def va = new VideoAnalysis()

videoInfos.each { name, size ->
    if(size == maxSize){
        def(isFFprobe, tryIndex) = va.tryLine(name as String, size as BigInteger, '/home/xiefeihong/视频', 1024 * 1024 * 10 as int)
        println isFFprobe
    }
}